<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改基础图表配置')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-base-edit" th:object="${baseChartConfig}">
            <input name="idChartPage" th:field="*{idChartPage}" type="hidden">
            <input name="menuId" th:field="*{menuId}" type="hidden">
            <div class="form-group">
                <label class="col-sm-3 control-label">名称：</label>
                <div class="col-sm-8">
                    <input name="na" th:field="*{na}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">URL：</label>
                <div class="col-sm-8">
                    <input name="url" th:field="*{url}" class="form-control" type="text">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">上级菜单：</label>
                <div class="col-sm-8">
                    <input id="treeId" name="parentMenuId" type="hidden" th:field="*{parentMenuId}"/>
                    <input type="text" onclick="selectMenuTree()" class="form-control"  id="treeName" name="parentMenuName" readonly="true" th:field="*{parentMenuName}">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "base/chart/config";
        $("#form-base-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-base-edit').serialize());
            }
        }
        /*菜单管理-新增-选择菜单树*/
        function selectMenuTree() {
            var menuId = 1;
            var url = "/base/sys/menu/selectMenuTree/" + menuId;
            var options = {
                title: '菜单选择',
                width: "380",
                url: url,
                callBack: doSubmit
            };
            $.modal.openOptions(options);
        }
        function doSubmit(index, layero){
            var body = $.modal.getChildFrame(index);
            $("#treeId").val(body.find('#treeId').val());
            $("#treeName").val(body.find('#treeName').val());
            $.modal.close(index);
        }
    </script>
</body>
</html>